package com.cyx.exam.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyx.exam.entity.Exam;
import com.cyx.exam.entity.Qu;
import com.cyx.exam.mapper.ExamMapper;
import com.cyx.exam.mapper.QuMapper;
import com.cyx.exam.service.QuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 问题题目 服务实现类
 * </p>
 *
 * @author cyx
 * @since 2021-03-09
 */
@Service
public class QuServiceImpl extends ServiceImpl<QuMapper, Qu> implements QuService {
    @Resource
    private QuMapper quMapper;

    @Override
    public int deleteById(Integer id) {
        QueryWrapper<Qu> wrapper = new QueryWrapper<Qu>();
        wrapper.eq("id",id);
        return quMapper.delete(wrapper);
    }

    @Override
    public int deleteByExamId(Integer examId) {
        QueryWrapper<Qu> wrapper = new QueryWrapper<Qu>();
        wrapper.eq("exam_id",examId);
        return quMapper.delete(wrapper);
    }
}
